<?php 
/**
* 
*/
class OcupacionesComiteController extends Sgit_Controller_Action
{
    
    protected $_checkZona = false;
    protected $_checkAcceso = false;
	
    protected $_main_model = 'OcupacionesComite';
    protected $_main_form = 'OcupacionesComite';
    
    protected $_file_upload =array(
             1=>array(
                'tabla'=>'ocupaciones_comite',
                'key'=>'files'
             ),
            
    );
    


    public function indexAction()
    {

        $rows = $this->_model->default->getAll();
        $this->view->rows =$this->_prepareRowsToTr($rows);
        
        
        
        $a=new Application_Model_Cuentas();
        $a->setZona(array(1,2,3,4,6));
        
        $a->setAnio(2011);
        
        print '<pre>';
print_r($a->getResumenMMR(10));
print '</pre>';
        
        
        
         $this->_model->default->getResumenInactividad(2011,8);
        
        
        
        
        
    }
    
    
    public function editarAction()
    {
        $this->_editar();
    }
    
    public function insertarAction()
    {
        $this->_insertar();
    }
    

    
    public function borrarAction()
    {
        Sgit_Util_removeFiles::run($this->_file_upload[1]['tabla'],$this->_file_upload[1]['key'],$this->_request->getParam('id'),'delete');
        $this->_borrar();
    }
    
    
    protected function _prepareValuesToDb1()
    {
        
        $row=$this->_form->getValues();
        Sgit_Util_removeFiles::run($this->_file_upload[1]['tabla'],$this->_file_upload[1]['key'],$this->_id,$row[$this->_file_upload[1]['key'].'_activos']);
          
        unset($row[$this->_file_upload[1]['key']]);
        unset($row[$this->_file_upload[1]['key'].'_activos']);
        

        return $row;
    }
    
    
    
    public function _prepareValuesToTr($row)
    {
        $row['mes']= Sgit_Filter_Mes::filter($row['mes']);
        return $row;
    }
	

}


